import 'package:earclean/app/config/colors.dart';
import 'package:earclean/app/modules/widget/app_bar_widget.dart';
import 'package:earclean/app/modules/widget/load_network_image_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../controllers/jishi_controller.dart';

class JishiView extends GetView<JishiController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: const AppBarWidget(titleStr: '技师列表'), body: tuijianWidget1());
  }

  Widget tuijianWidget1() {
    return Obx(() => Container(
          width: 1.sw,
          margin: EdgeInsets.symmetric(horizontal: 12, vertical: 10),
          child: ListView.separated(
              padding: EdgeInsets.zero,
              shrinkWrap: true,
              // physics: NeverScrollableScrollPhysics(),
              itemBuilder: ((context, index) {
                Map item = controller.list[index];
                return InkWell(
                  onTap: () {},
                  child: Container(
                    padding: EdgeInsets.symmetric(horizontal: 12, vertical: 10),
                    decoration: BoxDecoration(
                      color: ColorConfig.white,
                      // border: Border.all(color: ColorConfig.app_main, width: .5),
                      borderRadius: BorderRadius.all(Radius.circular(10.r)),
                    ),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Container(
                          clipBehavior: Clip.hardEdge,
                          decoration: const BoxDecoration(
                            // border: Border.all(color: ColorConfig.app_main, width: .5),
                            borderRadius: BorderRadius.all(Radius.circular(8)),
                          ),
                          child: LoadNetworkImageWidget(
                              width: 90.5,
                              height: 90.5,
                              imageUrl: item['avatar'] ?? ""),
                        ),
                        const SizedBox(width: 15),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              const SizedBox(height: 5),
                              Text(item['nickname'] ?? "",
                                  style: TextStyle(
                                    fontSize: 16.sp,
                                    color: ColorConfig.text_label,
                                  )),
                              const SizedBox(height: 5),
                              Row(
                                children: [
                                  Text(
                                      "经验${item['expYears'] ?? "1"}年  评论${item['userCommentNum'] ?? "100"}+  好评${item['pfr'] ?? ""}",
                                      style: TextStyle(
                                        fontSize: 14.sp,
                                        color: Color(0xFF5A5A5A),
                                      )),
                                ],
                              ),
                              const SizedBox(height: 16),
                              Row(
                                children: [
                                  const Spacer(),
                                  InkWell(
                                    onTap: () {
                                      controller.toYue(item);
                                    },
                                    child: Container(
                                      decoration: BoxDecoration(
                                        color: ColorConfig.app_main,
                                        // border: Border.all(color: ColorConfig.app_main, width: .5),
                                        borderRadius: BorderRadius.all(
                                            Radius.circular(5.r)),
                                      ),
                                      padding: const EdgeInsets.symmetric(
                                          horizontal: 13, vertical: 5),
                                      child: Text('预约',
                                          style: TextStyle(
                                            fontSize: 12.sp,
                                            color: ColorConfig.white,
                                          )),
                                    ),
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                );
              }),
              separatorBuilder: ((context, index) {
                return Container(height: 10);
              }),
              itemCount: controller.list.length),
        ));
  }
}
